loading the shape file of 911 calls from the Boston area. Displaying the header shows multiple columns such as Guns, PrivCon, SocDis, Viol, MajMed, and YthHth

calls911_shp <-st_read("911 BLK Yearly Ecometrics 2010-2020 Shapefile.shp")
## Reading layer `911 BLK Yearly Ecometrics 2010-2020 Shapefile' from data source 
##   `/Users/olivertoh/Documents/Spring 2022/Bostonography/hwk3/911 BLK Yearly Ecometrics 2010-2020 Shapefile.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 7288 features and 55 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: -71.1907 ymin: 42.22793 xmax: -70.98624 ymax: 42.40493
## Geodetic CRS:  WGS 84
#calls911_shp
head(calls911_shp)
## Simple feature collection with 6 features and 55 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: -71.111 ymin: 42.26564 xmax: -71.07679 ymax: 42.29711
## Geodetic CRS:  WGS 84
##         Blk_ID_10 Guns_10 Guns_11 Guns_12 Guns_13 Guns_14 Guns_15 Guns_16
## 1 250250923004001       0       0       0       2       0       1       1
## 2 250250924001006       1       1       2       0       3       1       2
## 3 250251404005012       0       0       0       2       1       0       0
## 4 250251404005013       0       1       0       0       0       0       0
## 5 250251404005014       0       2       0       0       1       0       0
## 6 250251404004002       0       0       0       0       0       0       0
##   Guns_17 Guns_18 Guns_19 Guns_ PrivCon_10 PrivCon_11 PrivCon_12 PrivCon_13
## 1       3       1       1     0          0          2          4         11
## 2       2       1       2     0          0          4          3          7
## 3       0       0       0     0          0          1          5          0
## 4       2       0       1     0          0          0          0          1
## 5       0       0       0     0          0          0          0          1
## 6       0       0       0     0          0          3          0          0
##   PrivCon_14 PrivCon_15 PrivCon_16 PrivCon_17 PrivCon_18 PrivCon_19 PrivCon_
## 1          0          2          1          0          2          1        0
## 2          4          2          6          2          0          3        1
## 3          1          1          2          2          1          0        2
## 4          1          0          2          1          1          0        2
## 5          1          3          1          2          0          0        0
## 6          0          0          0          0          0          0        1
##   SocDis_10 SocDis_11 SocDis_12 SocDis_13 SocDis_14 SocDis_15 SocDis_16
## 1         0         0         2         1         1         1         1
## 2         0         1         0         0         0         1         2
## 3         0         0         0         0         0         0         0
## 4         0         0         0         0         0         0         0
## 5         0         0         0         0         0         0         0
## 6         0         0         0         0         0         0         0
##   SocDis_17 SocDis_18 SocDis_19 SocDis_ Viol_10 Viol_11 Viol_12 Viol_13 Viol_14
## 1         1         1         1       1       5      10      21      28      13
## 2         0         0         0       0       0       4       3       7       8
## 3         0         0         0       0       0       2       3       2       1
## 4         0         0         0       0       0       0       1       3       1
## 5         0         0         0       0       0       1       0       0       0
## 6         0         0         0       0       0       0       1       0       0
##   Viol_15 Viol_16 Viol_17 Viol_18 Viol_19 Viol_ MajMed_10 MajMed_11 MajMed_12
## 1       8      14       7       5       9     7         5         9        10
## 2       5       8       4       2       1     6         3        15        11
## 3       1       0       7       0       1     3         3         6        18
## 4       1       2       0       0       1     2         3         4        14
## 5       1       0       3       2       0     0         0         5         9
## 6       0       0       0       0       0     0         2         0         0
##   MajMed_13 MajMed_14 YthHth_10 YthHth_11 YthHth_12 YthHth_13 YthHth_14
## 1        12         2         5        10         5         7         2
## 2        17         6         1         3         7        10         2
## 3        20         6         2         2         6        10         4
## 4        19         4         1         3         9         9         8
## 5         6         0         0         4         2         3         2
## 6         1         0         0         0         1         1         0
##                         geometry
## 1 MULTIPOLYGON (((-71.07704 4...
## 2 MULTIPOLYGON (((-71.08001 4...
## 3 MULTIPOLYGON (((-71.10767 4...
## 4 MULTIPOLYGON (((-71.10595 4...
## 5 MULTIPOLYGON (((-71.10819 4...
## 6 MULTIPOLYGON (((-71.1075 42...
ggplot() + geom_sf(data = calls911_shp)

Without any overlayed information, this displays Boston divided into census blocks

ggplot(calls911_shp) + 
  geom_sf()+
  aes(fill=Guns_) + aes(fill=PrivCon_) + aes(fill=SocDis_) + aes(fill=Viol_) + aes(fill=MajMed_10) + #aes(YthHth_10) +
  scale_fill_gradient2(midpoint=0,low = "blue",high="red",mid="white") +
  labs(fill = "911 Calls") +
  theme_void() 

Using ggplot, we can highlight the parts with the most gun, private conflict, social disorder, violence, and major medical emergency related 911 calls. However, the block lines are so dense that it is difficult to see where the highest concentrations are. It would help if the map was interactive, enabling zooming and dragging.

leaflet(calls911_shp)%>% addTiles()  %>% setView( lat=42.341374, lng=-71.078803 , zoom=13) %>%
  addPolygons( stroke = FALSE, fillOpacity = 0.5, smoothFactor = 0.5, color = ~colorNumeric("YlOrRd", Viol_)(Viol_) )

This is a great improvement, but I still think that it is a little hard to see. Also, only “Viol_” is being visualized

leaflet(calls911_shp)%>% addTiles()  %>% setView( lat=42.341374, lng=-71.078803, zoom=13) %>%
  addPolygons(stroke = FALSE, weight = 10, opacity = 0.5, fillOpacity = 0.75, smoothFactor = 1, color = ~colorNumeric("YlOrRd", Viol_)(Viol_))

Two points are most salient– firstly, Boston common seems to have a very high rate of violence-related 911 calls. At least when my friends and I walked there at night, there were just a bunch of dog walkers and stoners (and rats). Another very high rate area is exactly on the Boston Medical Center. Right across the street from the medical center has the highest rate of violence-related 911 calls. Unsurprisingly, these two blocks lie on the intersection of Massachusetts Avenue and Melnea Cass Boulevard– the “Methadone Mile.” That will be our next late night destination.